<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

 <ui:composition template="/template/templatcadastro.xhtml">
   <ui:define name="body">
   <h:head>
   <title>Unidade Federativa</title>
   </h:head>
   <h:body>
   <h:form id="frmuf">    
   <p:growl id="messages"/>
   
   <p:toolbar> 
     <p:toolbarGroup align="left"> 
     <h:commandButton action="#{beanUF.novo}"    value=""   image="botaosalvar" />
     <h:commandButton action="#{beanUF.salvar}"  value="Salvar" update="panel,display" icon="/images/Save.bmp" />
     <h:commandButton action="#{beanUF.excluir}" value="Excluir" />
     <p:separator />
     
     <h:commandButton value="Primeiro" action="#" />
     <h:commandButton value="Anterior" action="#" />
     <h:commandButton value="Próximo" action="#" />
     <h:commandButton value="Último" action="#" />
     
    </p:toolbarGroup>    
   </p:toolbar>
    
   <h:panelGrid columns="2">   
   <h:outputLabel value="Código" for="codigouf" />
   <h:inputText id="codigouf" label="Código" value="#{beanUF.uf.cduf}" readonly="true" size="6" />
   <p:outputLabel  value="Sigla"  for="siglauf" />
   <h:inputText style="text-transform:uppercase" id="siglauf"  label="Sigla" value="#{beanUF.uf.sguf}" size="2" length="6"  required="true" requiredMessage="Informe a Sigla da Unidade Federativa" />
   
   <p:outputLabel  value="Descrição"  for="nomeuf" />
   <h:inputText style="text-transform:uppercase"  id="nomeuf"  label="Descrição" value="#{beanUF.uf.nmuf}" size="70"  required="true" requiredMessage="Informe o Nome da Unidade Federativa" />

   </h:panelGrid>
  
   <br />
   
   <p:dataTable border="1" value="#{beanUF.listarUF}" var="ufLista"   paginator="true" rows="10"  emptyMessage="Nenhum Registro Foi Encontrado." loadingMessage="Buscando..." >
    
    <p:column headerText="Código">
    <h:outputText value="#{ufLista.cduf}" />
    </p:column> 
    
    <p:column headerText="Sigla" size="2">
    <h:outputText value="#{ufLista.sguf}" />
    </p:column> 

    <p:column headerText="Estado" size = "120">
    <h:outputText value="#{ufLista.nmuf}" />
    </p:column> 

   </p:dataTable>
   
   </h:form>
   </h:body>      
   </ui:define>
 </ui:composition>
</html>